const user = {
	state: {
		userInfo: null, // 用户信息
	},

	mutations: {
		SET_USERINFO: (state, userInfo) => {
			state.userInfo = userInfo
			// localStorage.setItem('loginUserInfo', JSON.stringify(userInfo))
		}
	},

	actions: {
		// 登录
		Login({
			commit,
			state,
			dispatch
		}, userInfo) {
			return new Promise((resolve, reject) => {
				let data = {
					username: 'zxw'
				}
				commit('SET_USERINFO', data)
				console.log(state);
				// loginAPI(userInfo).then(res => {
				// 	const data = res.data || {}
				// 	if (!data.hasOwnProperty('companyList')) {
				// 		commit('SET_AUTH', data)
				// 	}
				// 	resolve(res)
				// }).catch(error => {
				// 	reject(error)
				// })
			})
		},
	}
}

export default user
